<ul class="sitemap">
    <?php
    $linkStarts = $cquery->getSiteLink($SITE_ID);
    $siteLinks = $cquery->getCategoryList($linkStarts);
    drawSiteMap($siteLinks);

    function drawSiteMap($siteLinks) {
        global $cquery, $fxn;
        foreach ($siteLinks as $siteLink) {
            $url = $fxn->processURL("page", $siteLink["content_id"], $siteLink["page_title"], $siteLink["direct_link"]);
    ?>
  <li>
       <a href="<?php echo $url; ?>" title="<?php echo $siteLink["page_title"]; ?>">&raquo; <?php echo $siteLink["page_title"]; ?></a><?php
            $subLinks = $cquery->getCategoryList($siteLink["category_id"]);
            if ($subLinks->getUnlimitedNumberRows() > 0) {
    ?>  <ul class="sub">
            <?php drawSiteMap($subLinks); ?>
        </ul>
<?php } ?>
    </li>
        <?php
        }
    }
        ?>
</ul>